import { domainService } from '~/config/server';
import { NetService } from '~/utils/net.service';
import { Inject, Debounce } from '~/core/decorator';
import { Service } from '~/core/service';

export class CarManageService extends Service {
  @Inject(NetService)
  private netService: NetService


  /**
   * 车库管理查询列表
   */
  public getAllGarages(data, page?, sort?) {
    return this.netService.send({
      server: domainService.carManageController.getAllGarages,
      data,
      page,
      sort,
    });
  }
  /**
   * 新增车库
   */
  public addGarage(data) {
    return this.netService.send({
      server: domainService.carManageController.addGarage,
      data
    })
  }
  /**
   * 修改车库
   */
  public updateGarage(data) {
    return this.netService.send({
      server: domainService.carManageController.updateGarage,
      data
    })
  }
  /**
   * 库存车辆列表
   */
  public getAllWarehouseCar(data, page) {
    return this.netService.send({
      server: domainService.carManageController.getAllWarehouseCar,
      data,
      page
    })
  }

  /**
   * 全部车库列表
   */
  public getAllGaragesList() {
    return this.netService.send({
      server: domainService.carManageController.getAllGaragesList
    })
  }

  /**
   * 车库下面的所有库管员
   */
  public getGarageUsersById(garageId) {
    return this.netService.send({
      server: domainService.carManageController.getGarageUsersById,
      data: {
        garageId
      }
    })
  }

  public updateWarehouseCar(data) {
    return this.netService.send({
      server: domainService.carManageController.updateWarehouseCar,
      data
    })
  }

  public getAllWarehouseApproval(data, page) {
    return this.netService.send({
      server: domainService.carManageController.getAllWarehouseApproval,
      data,
      page
    })
  }
  /**
   * 获取当前案件的库存车辆信息
   */
  public getWarehouseCarByCaseInfoRecordId(taskId) {
    return this.netService.send({
      server: domainService.carManageController.getWarehouseCarByCaseInfoRecordId,
      data: {
        taskId
      }
    })
  }
  /**
   * 变更归属信息
   */
  public updateApplyUserInfo(data) {
    return this.netService.send({
      server: domainService.carManageController.updateApplyUserInfo,
      data
    })
  }
  /**
   * 出入库审核
   */
  public warehouseApproval(data) {
    return this.netService.send({
      server: domainService.carManageController.warehouseApproval,
      data
    })
  }

  /**
   * 车辆入库报表
   */
  public getWarehouseCarReport(data, page) {
    return this.netService.send({
      server: domainService.carManageController.getWarehouseCarReport,
      data,
      page
    })
  }

  /**
   * 车辆入库报表导出
   */
  public warehouseCarReportExport(data) {
    return this.netService.send({
      server: domainService.carManageController.warehouseCarReportExport,
      data
    })
  }
}
